<!DOCTYPE HTML />
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title><?php echo $view['news']['title']; ?></title>
    <?php include_once("common/common_js.php") ?>
</head>
<body>
<?php include_once("common/banner.php"); ?>
<div class="warpper">
    <?php include_once("common/header.php"); ?>
    <div class="al">
        <h3>新闻详细内容</h3>

        <div class="content">        <?php echo $view['news']['content']; ?></div>
        <p>

        <h3>文章评论</h3>
        <ul>
            <?Php
                                $comment = $this->modules->Comment;
            $comments = $comment->findByOperatorIdAndType($view['news']['newsId'], 'NEWS');
            $count = 1;
            foreach ($comments as $comment) {

                ?>
                <li><em>评论<?php echo $count; ?>(作者:<?php echo $comment['userName'] ?>
                    )</em>

                    <p><?php echo $comment['content'] ?></p></li>
                <?php $count++;
            } ?>
        </ul>
        <div>
            <form name="form1" action="/index.php/comment/add" method="post">
                <input type="hidden" name="backUrl" value="/index.php/news/show/<?php echo $view['news']['newsId'] ?>"/>
                <input type="hidden" name="operatorId" value="<?php echo $view['news']['newsId'] ?>"/>
                <input type="hidden" name="type" value="NEWS"/>
                <textarea rows="5" cols="10" name="content"></textarea>
                <button type="button" onclick="add()">提交留言</button>
            </form>

        </div>
        </p>
    </div>
    <?php include("common/footer.php"); ?>
</div>

<script language="javascript">
    function add() {
        $.get("/index.php/ajax/isLogin", function(data) {
            if (data == "1") {
                eval("document.form1.submit()");
            }
            else {
                alert('请先登录');
                return false;
            }
        })
    }
</script>
</body>
</html>